﻿

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <link href="~/Content/layui/css/layui.css" rel="stylesheet" />
    <script src="~/Content/layui/layui.js"></script>
    <script src="~/Content/myjs/jquery-1.10.2.js"></script>
</head>
<body>

    <div class="layui-col-md8" style="margin-left:10%;margin-right:10%">

        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>非耗材借出审核</legend>
        </fieldset>


        <form class="layui-form layui-form-pane" lay-filter="form_add">

            <input type="text" name="instanceId" value="@ViewBag.Instance.InstanceId" readonly="readonly" style="display:none">

            <div class="layui-form-item">

                <label class="layui-form-label">是否通过</label>
                <div class="layui-input-inline">
                    <select name="isPass">
                        <option value="true">通过</option>
                        <option value="false">驳回</option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">审核意见</label>
                <div class="layui-input-block">
                    <textarea placeholder="请输入领用理由" class="layui-textarea" lay-verify="required" name="reason"></textarea>
                </div>
            </div>

            <div class="layui-form-item" style="text-align:center">
                <button class="layui-btn" lay-submit="" lay-filter="formDemo">提交</button>
            </div>
        </form>
    </div>

    <script>



        layui.use(['form', 'layedit', 'laydate'], function () {
            var form = layui.form
            var layedit = layui.layedit

            //监听提交
            form.on('submit(formDemo)', function (data) {
                debugger;
                $.ajax({
                    url: '/WorkFlow/ReviewEquipment',
                    method: 'post',
                    data: data.field,
                    success: function (data) {

                        if (data == "ok") {
                            layer.alert("审核成功！");
                            setTimeout(function () {
                                //休眠1秒后页面跳转
                                window.location.href = "/Goods_Equipment/ReviewingIndex?id=" + @ViewBag.Instance.Id + "";
                                //关闭当前弹框
                                //var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                //parent.layer.close(index); //再执行关闭
                            }, 2000);


                        } else {
                            layer.alert("审核失败");
                        }
                    }
                });
                return false;//防止页面跳转
            });
        });
    </script>

</body>
</html>
